/**
 * Copyright:Copyright(c)2014-2017
 * Company:厦门市易致达物联网科技有限公司
 * @version 1.0
 */
package shop.services.front.news.dao.impl;

import java.util.List;

import shop.core.common.dao.BaseDao;
import shop.core.common.dao.page.PagerModel;
import shop.services.front.news.bean.News;
import shop.services.front.news.dao.NewsDao;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;

/**
 * @类名称：NewsDaoImpl
 * @创建人：Ltz
 * @创建时间：2017-09-20 下午15:47:58  
 * @版本号：1.0
 * @描述：
 */
@Repository("newsDaoFront")
public class NewsDaoImpl  implements NewsDao {

    @Resource
    private BaseDao dao;

    public void setDao(BaseDao dao) {
        this.dao = dao;
    }

    public PagerModel selectPageList(News e) {
        return dao.selectPageList("front.news.selectPageList","front.news.selectPageCount", e);
    }

    public List selectList(News e) {
        return dao.selectList("front.news.selectList", e);
    }

    public News selectOne(News e) {
        return (News) dao.selectOne("front.news.selectOne", e);
    }

    public int delete(News e) {
        return dao.delete("front.news.delete", e);
    }

    public int update(News e) {
        return dao.update("front.news.update", e);
    }

    public int deletes(String[] ids) {
        News e = new News();
        for (int i = 0; i < ids.length; i++) {
            e.setId(ids[i]);
            delete(e);
        }
        return 0;
    }

    public int insert(News e) {
        return dao.insert("front.news.insert", e);
    }

    public int deleteById(int id) {
        return dao.delete("front.news.deleteById", id);
    }

    @Override
    public News selectById(String id) {
        return (News) dao.selectOne("front.news.selectById", id);
    }

}

